cd $MODPATH
if [ ! -d "ringtones" ]; then
    abort "[!] Error: ringtones folder not found";
fi

# Check which media folder the system uses
for path in "system/media/audio" "system/product/media/audio"; do
    if [ -d "/$path" ]; then
        target_path=$path;
        break;
    fi;
done
if [ ! -n "$target_path" ]; then
    abort "[!] Error: Unable to determine your system media/audio folder";
fi

ui_print "* Found system media/audio folder: /$target_path"
mkdir -p "$target_path"
for name in "ringtones" "alarms"; do
    ui_print "* Copy 'ringtones' to '$target_path/$name'";
    cp -R "ringtones" "$target_path/$name";
done
